<?php
date_default_timezone_set('Asia/Shanghai'); 
header("Content-type: text/html; charset=utf-8");
$pay_memberid = "10XXX";   //商户ID
$pay_orderid = date("YmdHis").rand(1000,9999);    //订单号
$pay_amount = 1;    //交易金额
$pay_applydate = date("Y-m-d H:i:s");  //订单时间
$pay_bankcode = "WXZF";   //银行编码
$pay_notifyurl = "";   //服务端返回地址
$pay_callbackurl = "";  //页面跳转返回地址
$Md5key = "XXXXXXXX";    //密钥
$tjurl = "http://XXXXXX/Pay_Index.html"; //网关提交地址

$jsapi = array(
    "pay_memberid" => $pay_memberid,
    "pay_orderid" => $pay_orderid,
    "pay_amount" => $pay_amount,
    "pay_applydate" => $pay_applydate,
    "pay_bankcode" => $pay_bankcode,
    "pay_notifyurl" => $pay_notifyurl,
    "pay_callbackurl" => $pay_callbackurl,
);
ksort($jsapi);
$md5str = "";
foreach ($jsapi as $key => $val) {
    $md5str = $md5str . $key . "=" . $val . "&";
}
$sign = strtoupper(md5($md5str . "key=" . $Md5key));
$jsapi["pay_md5sign"] = $sign;
$jsapi["pay_tongdao"] = 'Haifu'; //通道
$jsapi["pay_tradetype"] = '6'; //通道类型 
$jsapi["pay_productname"] = '会员服务'; //商品名称
$ch = curl_init();
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, $tjurl);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsapi);
$result = curl_exec($ch);
curl_close($ch);
print_r($result);exit;




?>
